<template>
  <!--设备调拨管理-->
  <div style="padding: 20px">
    <el-card class="box-card">
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane label="全部" name="first">
          <el-button type="primary" @click="handleNew">新建</el-button>
          <el-button type="danger" @click="handleDelete">删除</el-button>
          <el-button @click="handleClose">关闭</el-button>
          <el-button @click="handleExport">导出</el-button>
          <el-input placeholder="请输入设备编号或名称" clearable prefix-icon="el-icon-search" suffix-icon="el-icon-s-cale"
            style="width: 250px; margin-left: 540px" />
          <el-popover placement="right" width="400" trigger="click">
            <svg-icon icon-class="caiss" style="width: 40px; height: 20px" class="pointer" slot="reference" />
          </el-popover>
          <el-table :data="data" style="width: 100%; margin-top: 20px" size="medium">
            <el-table-column type="selection" width="55" align="center" />
            <el-table-column label="序号" width="50" align="center">
              <template slot-scope="scope">{{ scope.$index + 1 }}</template>
            </el-table-column>
            <el-table-column label="操作" width="80" align="center">
              <template v-slot="scope">
                <el-button type="text" @click="handleView(scope.row)">查看</el-button>
              </template>
            </el-table-column>
            <el-table-column prop="state" label="状态" align="center">
              <template slot-scope="scope">
                <el-tag type="success" effect="dark" v-if="scope.row.state == 0">待审核</el-tag>
                <el-tag type="warning" effect="dark" v-if="scope.row.state == 1">完成</el-tag>
                <el-tag type="danger" effect="dark" v-if="scope.row.state == 2">驳回</el-tag>
              </template>
            </el-table-column>
            <el-table-column prop="code" label="调拨单号" width="180" align="center" />
            <el-table-column prop="topic" label="调拨主题" width="120" align="center" />
            <el-table-column prop="creationTime" label="申请时间" width="120" align="center" />
            <el-table-column prop="department" label="申请部门" align="center" />
            <el-table-column prop="applicant" label="申请人" align="center" />
            <el-table-column prop="type" label="调拨类型" align="center" />
            <el-table-column prop="sun" label="调拨设备" align="center" />
            <el-table-column prop="remark" label="备注" align="center" />
          </el-table>
          <el-pagination background style="margin-top: 20px; text-align: right" :page-size="10" :total="45"
            layout="prev, pager, next, sizes, total" :page-sizes="[10, 20, 30, 50]" />
        </el-tab-pane>
        <el-tab-pane label="我的申请" name="second">我的发起</el-tab-pane>
        <el-tab-pane label="我的审批" name="third">我的审批</el-tab-pane>
      </el-tabs>
    </el-card>
  </div>
</template>

<script>
import { SelectAllocate } from "@/api/eastjet-maintenance/dao/dao";
export default {
  data() {
    return {
      //卡片信息
      activeName: "first",
      searchText: "",
      data: [],
      currentPage: 1,
      pageSize: 10,
    };
  },
  created() {
    this.getlist()
  },
  methods: {
    getlist() {
      SelectAllocate("").then((res) => {
        this.data = res.data.data.list
        console.log("数据制造", res.data.data.list)
      })
    },
    //卡片选择信息
    handleClick(tab, event) {
      console.log("卡片", tab, event);
    },
    handleSearch() {
      this.currentPage = 1;
    },
    handleNew() {
      // 处理新建操作
      this.$router.push({ path: "/sb/chu/diao/xin" });
    },
    handleDelete() {
      // 处理删除操作
    },
    handleView(row) {
      // 查看具体信息
      this.$router.push({ path: "/sb/chu/diao/cha", query: { code: row.code } });
    },
    handleClose() {
      // 处理关闭操作
    },
    handleExport() {
      // 处理导出操作
    },
    handlePageChange(page) {
      this.currentPage = page;
    },
  },
};
</script>

<style>
/* 自定义样式 */
.text {
  font-size: 14px;
}

.item {
  padding: 18px 0;
}

.box-card {
  width: 1210px;
  height: 660px;
  margin-left: 14px;
}
</style>
